<?php
/**
 * @author Radovan Dvorsky
 * @version 20100225
 */
require_once ('application/default/models/Db/Mapper/MapperAbstract.php');

class Db_Mapper_ProfessorCommission extends Db_Mapper_Abstract {
	
	/**
	 * Vrati "role" z databaze pre profesora z danej komisie
	 * 
	 * @param Db_Model_Professor $professor
	 * @param Db_Model_Commission $commission
	 * 
	 * @return Db_Model_ProfessorCommission
	 */
	public function fetchRole(Db_Model_Professor $professor, Db_Model_Commission $commission){
		
		if(!$professor instanceof Db_Model_Professor){
			throw new Exception('$professor is not instance of Db_Model_Professor');
		}
		
		if(!$commission instanceof Db_Model_Commission){
			throw new Exception('$commission is not instance of Db_Model_Commission');
		}	
		
		$select = $this->getTable()->select();
		$select->where('pid = ?',$professor->getPid())
		->where('cid = ?',$commission->getCid());
		
		return $this->fetchRow($select);	
	}
}

?>